package com.das.mechanic_base.adapter.intensivetain;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.das.mechanic_base.R;
import com.das.mechanic_base.bean.maintain.UnFinishStepBean;

import java.util.List;

/**
 * 作者：zhanglei on 2020-04-07 01:35
 * <p>
 * 邮箱：916256628@qq.com
 */
public class X3UnFinishStepAdapter extends RecyclerView.Adapter<X3UnFinishStepAdapter.MyViewHolder> {

    private Context context;

    private List<UnFinishStepBean> list;

    public X3UnFinishStepAdapter(Context context, List<UnFinishStepBean> list) {
        this.context = context;
        this.list = list;
    }

    @NonNull
    @Override
    public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {

        View view = LayoutInflater.from(context).inflate(R.layout.x3_unfinish_step_tip, parent, false);
        MyViewHolder myViewHolder = new MyViewHolder(view);
        return myViewHolder;
    }

    @Override
    public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
        if (list.get(position).isStandardOrNot()) {
            holder.tv_context.setText(list.get(position).getName() + "  "+context.getString(R.string.x3_standard_chemical_procedure));
        } else {
            holder.tv_context.setText(list.get(position).getName() + "  "+context.getString(R.string.x3_custom_record));
        }
    }

    @Override
    public int getItemCount() {
        return list.size() != 0 ? list.size() : 0;
    }

    class MyViewHolder extends RecyclerView.ViewHolder {

        private TextView tv_context;

        private TextView tv_tip;

        public MyViewHolder(@NonNull View itemView) {
            super(itemView);
            tv_context = itemView.findViewById(R.id.tv_context);
            tv_tip = itemView.findViewById(R.id.tv_tip);

        }
    }
}
